﻿using StudentManagement.Model.DTO;
using StudentManagement.Model.Entitys;
using System;
using System.Collections.Generic;
using System.Data;

namespace StudentManagement.IRepository
{
    /// <summary>
    /// 学生仓储接口
    /// </summary>
    public interface IStudentRepository
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        void Insert(StudentEntity entity);

        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        void Update(StudentEntity entity);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        void Delete(int id);

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="qs">搜索文本</param>
        /// <returns></returns>
        Tuple<List<StudentQueryDTO>, int> Search(string qs, int limit, int page);

        /// <summary>
        /// 根据ID查询实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        StudentEntity GetById(int id);

        /// <summary>
        /// 学号是否存在
        /// </summary>
        /// <returns></returns>
        bool NumberIsExist(string number);

        /// <summary>
        /// 学号是否存在,排除当前用户
        /// </summary>
        /// <returns></returns>
        bool NumberIsExist(string number, int id);

        /// <summary>
        /// 获取查询结果的全部不分页的数据
        /// </summary>
        /// <param name="qs"></param>
        /// <returns></returns>
        DataTable GetData(string qs);
    }
}
